import fetch from './../../../static/js/common'

/**
 * 获取数据字典信息
 * @param param
 * @returns {Promise<T | never>}
 */
export function getDicItemByCode(param) {
  return fetch('/je/dd/dd/getDicItemByCode', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true
  })
    .then(data => data)
    .catch()
}

/**
 * 获取系统设置信息
 * @param param
 * @returns {Promise<T | never>}
 */
export function loadSysVariables(param) {
  return fetch('/je/sysConfig/sysConfig/loadSysVariables', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true
  })
    .then(data => data)
    .catch()
}

/**
 * 保存系统设置信息
 * @param param
 * @returns {Promise<T | never>}
 */
export function writeSysVariables(param) {
  return fetch('/je/sysConfig/sysConfig/writeSysVariables', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true
  })
    .then(data => data)
    .catch()
}
